<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!doctype html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title>后台管理</title>
    <link rel="stylesheet" type="text/css" href="/CourseDesign4/manage/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="/CourseDesign4/manage/css/main.css"/>
</head>
<body>
	<!-- 菜单 -->
	<%@ include file="admin_menu.jsp" %>
	
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="admin_index.jsp">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">分类管理</span></div>
        </div>
        <%-- <div class="search-wrap">
            <div class="search-content">
                <form action="###" method="get">
                    <table class="search-tab">
                        <tr>
                            <th width="70">关键字:</th>
                            <td><input class="common-text" placeholder="关键字" name="keywords" value="${param.keywords}" id="" type="text"></td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div> --%>
        <div class="result-wrap">
            <form action="###" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="/CourseDesign4/manage/admin_tocateadd"><i class="icon-font"></i>新增分类</a>
                        <a id="batchDel" href="javascript:delmore('确定删除这些用户吗?','myform')"><i class="icon-font"></i>批量删除</a>
                        <!-- <a id="updateOrd" href="javascript:void(0)"><i class="icon-font"></i>更新排序</a> -->
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th width="20%">ID</th>
                            <th width="50%">分类名称</th>
                            <th width="30%">操作</th>
                        </tr>
                        
                        <!-- 使用JSTL遍历输出用户信息 -->
                        <c:forEach items="${catelist}" var="cate">
                        	<c:if test="${cate.parent_id==0}">
	                        	<tr>
	                        		<td>${cate.id}</td>
		                            <td>|-${cate.name}</td> 
		                            <td>
		                                <a class="link-update" href="/CourseDesign4/manage/admin_tocateupdate?id=${cate.id}">修改</a> 
		                                <a class="link-update" href="###">删除</a> 
		                            </td>
		                         </tr>
		                          <c:forEach items="${catelist}" var="cate2">
		                        	<c:if test="${cate2.parent_id==cate.id}">
			                        	<tr>
			                        		<td>${cate2.id}</td>
				                            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|-${cate2.name}</td> 
				                            <td>
				                                <a class="link-update" href="/CourseDesign4/manage/admin_tocateupdate?id=${cate2.id}">修改</a> 
				                                <a class="link-update" href="###">删除</a> 
				                            </td>
				                         </tr>
		                        	</c:if>
                        		</c:forEach>
                        	</c:if>
                        </c:forEach>
                        
                        <script>
                        	// 删除判断函数
                        	function delUser(mess, url)
                        	{
                        		var flag = confirm(mess);
                        		if(flag) location.href = url;
                        	}
                        </script>
                        
                    </table>
                </div>
            </form>
        </div>
    </div>
    <!--/main-->
</div>
</body>
</html>